Skip to content

Conversation

Chandru03
Copy link

@Chandru03 Chandru03 commented Jul 26, 2025

🎯 Overview - Issue #42

This PR implements comprehensive support for Custom Resource Definitions (CRDs) and Custom Resource (CR) creation, enabling users to import CRDs and generate Custom Resources through dynamic form generation based on OpenAPI v3 schemas.

✨ Features Added

🔧 CRD Management

  • CRD Import: Paste or upload CRD YAML with real-time validation
  • CRD Storage: Persistent storage of imported CRDs in project state
  • CRD Visualization: List view with schema inspection capabilities
  • CRD Schema Viewer: Interactive tree view for detailed schema exploration

🎨 Dynamic Custom Resource Creation

  • Schema-Based Forms: Dynamic form generation from CRD OpenAPI v3 schemas
  • Multi-Type Support: Handles strings, numbers, booleans, arrays, and nested objects
  • Real-Time Validation: Form validation based on schema constraints
  • Live YAML Preview: Toggle between form and YAML views with real-time updates

📋 Custom Resource Management

  • CR Creation: Create Custom Resources from imported CRDs
  • CR Editing: Modify existing Custom Resources
  • CR Deletion: Remove Custom Resources from project
  • CR YAML Viewing: Individual YAML preview for each Custom Resource

🔗 Integration Features

  • YAML Pipeline: Custom Resources included in main YAML generation
  • Resource Summary: CRs appear in project overview and validation
  • Visual Preview: CRs recognized in architecture diagrams
  • Auto-Save: Custom Resources persist with project configuration

🛠️ Technical Implementation

Core Components

  • CrdManager.tsx: CRD import and validation interface
  • CrdList.tsx: CRD listing with management actions
  • CrdSchemaViewer.tsx: Interactive schema visualization
  • CustomResourceForm.tsx: Dynamic form generator for CR creation
  • CustomResourcesList.tsx: CR management interface

Type Safety

  • Comprehensive TypeScript interfaces for CRDs and CRs
  • Full type safety for schema parsing and form generation
  • Proper error handling and validation

User Experience

  • Intuitive Interface: Clean, consistent design following project patterns
  • Responsive Design: Works seamlessly across all device sizes
  • Accessibility: Proper ARIA labels and keyboard navigation
  • Error Handling: Clear feedback for validation errors and edge cases

🧪 Testing

Manual Testing Completed

  • ✅ CRD import via paste and file upload
  • ✅ Dynamic form generation for various schema types
  • ✅ Real-time YAML preview and validation
  • ✅ CR creation, editing, and deletion workflows
  • ✅ Integration with existing YAML generation pipeline
  • ✅ Cross-browser compatibility (Chrome, Firefox, Safari)

Test Cases

  • Simple CRD with basic string/number fields
  • Complex CRD with nested objects and arrays
  • CRD with enum values and constraints
  • Namespaced and Cluster-scoped CRDs
  • Error handling for invalid CRD YAML

Files Changed

New Components

  • src/components/CrdManager.tsx - CRD import interface
  • src/components/CrdList.tsx - CRD listing and management
  • src/components/CrdSchemaViewer.tsx - Schema visualization
  • src/components/CustomResourceForm.tsx - Dynamic CR form generator
  • src/components/CustomResourcesList.tsx - CR management interface

Updated Components

  • src/App.tsx - Integration of CRD/CR state management
  • src/components/ResourceSummary.tsx - Added CR summary
  • src/components/VisualPreview.tsx - CR recognition in diagrams
  • src/utils/yamlGenerator.ts - CR YAML generation integration

Type Definitions

  • src/types/crd.ts - CRD and CR TypeScript interfaces

🎯 Impact

User Benefits

  • Enhanced Flexibility: Support for custom Kubernetes resources
  • Improved Workflow: Seamless CRD → CR → YAML pipeline
  • Better Validation: Schema-based form validation
  • Time Savings: No manual YAML writing for Custom Resources

Project Benefits

  • Feature Completeness: Comprehensive Kubernetes resource support
  • Code Quality: Well-structured, type-safe implementation
  • Maintainability: Modular design with clear separation of concerns
  • Extensibility: Foundation for future CRD-related features

🔄 Migration Notes

  • No breaking changes to existing functionality
  • All existing features remain unchanged
  • CRD/CR data automatically saved with project state
  • Backward compatible with existing project files

Checklist

  • CRD import and validation
  • Dynamic form generation from schema
  • Real-time YAML preview
  • CR management (create, edit, delete, view)
  • Integration with YAML generation pipeline
  • Resource summary and visual preview integration
  • Comprehensive error handling
  • Responsive design implementation
  • TypeScript type safety
  • Manual testing across browsers

🚀 Ready for Review

This implementation provides a complete, production-ready CRD feature that enhances Kube Composer's capabilities while maintaining the project's high standards for code quality and user experience.

…nd App components: Added menu component as sidebarTab
…orm components; integrated state management and auto-save for CRDs in App component.
…list, editing, viewing, and deletion functionalities in App component; updated ResourceSummary and VisualPreview components to include custom resources; enhanced YAML generation to support custom resources.
Copy link

netlify bot commented Jul 26, 2025

Deploy Preview for gorgeous-maamoul-daf273 ready!

Name Link
🔨 Latest commit 651a121
🔍 Latest deploy log https://app.netlify.com/projects/gorgeous-maamoul-daf273/deploys/68855832e268ed000823fe5c
😎 Deploy Preview https://deploy-preview-64--gorgeous-maamoul-daf273.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@same7ammar
Copy link
Owner

Hello @Chandru03 ,

Thank you for submitting this PR ,

I have checked this PR and we have sometimes .

  1. When we import the CRD into Kube-composer , there's no need to add it to Yaml section , User don't need it .
  2. When user click on Create custom Resource , User is not able to type in nested object in the form .
image
  1. Some fields are not clear for end user to fill as below .
image
  1. We need to add Custom Resource to Yaml section .

Thank you so much .

@Chandru03
Copy link
Author

Thank you so much for your comments on this. I'll definitely try to implement a different approach or fix this issues within the implementation!

Once I complete it, can I raise a new Pull Request?

@same7ammar
Copy link
Owner

Hello @Chandru03 ,
since this PR is not merged you can fix the issue and push the changes again .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants